package extreme.refactor.gilded_rose;

public class Backstage extends Item {
    public Backstage(String name, Integer sellIn, Integer quanlity) {
        super(name, sellIn, quanlity);
    }

    public static Item getBackstage(Item items) {
        if (items.sellIn > 10) {
            items.sellIn = items.sellIn - 1;
            items.quanlity = items.quanlity + 1;
        } else if (items.sellIn <= 0) {
            items.sellIn = items.sellIn - 1;
            items.quanlity = 0;
        } else if (items.sellIn > 0 && items.sellIn <= 5) {
            items.sellIn = items.sellIn - 1;
            items.quanlity = items.quanlity + 3;
        } else if (items.sellIn > 5 && items.sellIn <= 10) {
            items.sellIn = items.sellIn - 1;
            items.quanlity = items.quanlity + 2;
        }
        if (items.quanlity > 50) {
            items.quanlity = 50;

        }
        return items;
    }
}
